package com.wy.springbootblog.pojo;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
import java.util.List;

@Data
@NoArgsConstructor
@AllArgsConstructor
@TableName("`comment`")
public class Comment {

    @TableId
    private Integer id;

    @TableField("parent_id")
    private Integer parentId;

    @NotEmpty(message = "评论内容不能为空")
    private String content;

    @TableField("create_time")
    private LocalDateTime createTime;

    @TableField("update_time")
    private LocalDateTime updateTime;

    @TableField("user_id")
    private Integer userId;

    @TableField("article_id")
    @NotNull(message = "文章id不能为空")
    private Integer articleId;

    private Integer flag;

    @TableField(exist = false)
    private List<Comment> children;
}
